package cn.picclife.mwx.manager.sys.controller;

import java.io.*;
import java.nio.charset.Charset;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import cn.picclife.mwx.app.util.MD5Util;
import cn.picclife.mwx.common.core.util.JsonUtils;
import cn.picclife.mwx.manager.sys.mapper.DataCollectMapper;
import cn.picclife.mwx.manager.sys.model.bo.*;
import cn.picclife.mwx.manager.sys.service.DownLoadFile;
import cn.picclife.mwx.manager.sys.service.impl.CollectDataServiceImpl;
import cn.picclife.mwx.manager.util.*;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.Configuration;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;

import cn.picclife.mwx.manager.base.BaseResult1;
import cn.picclife.mwx.manager.base.ResponseHeadDto;
import cn.picclife.mwx.manager.sys.model.po.CompareSysTimeRes;
import cn.picclife.mwx.manager.sys.model.po.DataCollect;
import cn.picclife.mwx.manager.sys.service.CollectDataService;
import cn.picclife.mwx.manager.util.enums.ResponseStatusEnum;
import org.springframework.web.multipart.MultipartFile;

/**
 * 数据采集接口
 * @author wzd 
 * create by 20200709
 */
@RequestMapping("collect")
@RestController
public class CollectDataController {

	private Log log = LogFactory.getLog(CollectDataController.class);
	
	@Autowired
	private CollectDataService  collectDataServiceImpl;
	
	@Autowired
	private RedisUtil redisUtil;
	private static String fengefu;
	private static String jieyapath;
	private static String lingshibaocun;
	private static String singlezip;
	private static String encryptionsalt;

	static {
		try {
			Properties prop = new Properties();
			InputStream in = CollectDataController.class.getResourceAsStream("/config.properties");
			prop.load(in);
			fengefu = prop.getProperty("upload.fengefu").trim();
			jieyapath = prop.getProperty("upload.jieyapath").trim();
			lingshibaocun = prop.getProperty("upload.lingshibaocun").trim();
			singlezip = prop.getProperty("singlezip").trim();
			encryptionsalt = prop.getProperty("encryptionsalt").trim();
			System.out.println("获取配置文件upload属性成功！！！！"+fengefu+"    "+jieyapath+"    "+lingshibaocun+"    "+singlezip+"    "+encryptionsalt);
		} catch (IOException e) {
			System.out.println("txt上传与zip包上传用到的属性加载失败");
			//手动设置
			fengefu="====BehaviorTraceVedioBack====";
			jieyapath="/data/work/appdata/systembak/NrrWeb/zip/";
			lingshibaocun="/data/work/appdata/systembak/NrrWeb/test/";
			singlezip="data/hsxtdata/data/systembak/NrrWeb/singlezip/";
			System.out.println("手动设置fengefu、jieyapath、lingshibaocun、singlezip、encryptionsalt");
		}
	}

	/**
	 * 数据采集接口  加密
	 * @param
	 * @return
	 */
//	@RequestMapping(value="/nrrwebApi/saveCollect", method= {RequestMethod.POST})
	@RequestMapping(value="/saveCollect", method= {RequestMethod.POST})
	public DataResponse nrrwebApiSaveCollect(@RequestBody AseReq aseReq,HttpServletRequest request) {
		DataResponse dataResponse = new DataResponse();
		String updateStr = aseReq.getUpdateStr();
		String aeskey = request.getHeader(ResponseStatusEnum.HREAD_AES_KET.getCode());// aes加密后的key
		SaveCollectRequest req =new SaveCollectRequest();
			//解密过程
			log.info("===========saveCollect数据保存接口请求报文："+updateStr);
			String decrypt="";
			try {
				decrypt = ASUtils.decrypt(updateStr, aeskey, ResponseStatusEnum.AES_KEY.getName());
				log.info("解密后字符串："+decrypt);
			} catch (Exception e1) {
//			e1.printStackTrace();
				dataResponse.setCode(ResponseStatusEnum.AES_ERROR.getCode());
				dataResponse.setMsg(ResponseStatusEnum.AES_ERROR.getName());
				log.info("===========saveCollect数据保存接口返回报文："+JSONObject.toJSON(dataResponse).toString());
				return dataResponse;
			}
			req = JSON.parseObject(decrypt, SaveCollectRequest.class);
		log.info(req.getUuid()+"===========saveCollect数据采集接口请求开始===="+Calendar.getInstance().getTime()+"=="+JSONObject.toJSON(req).toString());
		if(null==req||null==req.getUuid()||req.getUuid().trim().length()<=0||
				req.getSystemCode()==null||req.getSystemCode().trim().length()<=0) {
			dataResponse.setCode(ResponseStatusEnum.PARAM_IS_NULL.getCode());
			dataResponse.setMsg(ResponseStatusEnum.PARAM_IS_NULL.getName());
			log.info(req.getUuid()+"===========saveCollect数据采集接口返回报文："+JSONObject.toJSON(dataResponse).toString());
			return dataResponse;
		}
		try {
			collectDataServiceImpl.saveData(req);
		} catch (Exception e) {
//			e.printStackTrace();
			dataResponse.setCode(ResponseStatusEnum.EXCEPTION.getCode());
			dataResponse.setMsg(ResponseStatusEnum.EXCEPTION.getName());
			log.info(req.getUuid()+"===========saveCollect数据采集接口返回报文："+JSONObject.toJSON(dataResponse).toString());
			return dataResponse;
		}
		dataResponse.setCode(ResponseStatusEnum.SUCCESS_CODE.getCode());
		dataResponse.setMsg(ResponseStatusEnum.SUCCESS_CODE.getName());
		log.info(req.getUuid()+"===========saveCollect数据采集接口返回报文："+JSONObject.toJSON(dataResponse).toString());
		return dataResponse;
	}
	/**
	 * 数据采集接口
	 * @param req 
	 * @return
	 */
//	@RequestMapping(value="/saveCollect", method= {RequestMethod.POST})
//	@RequestMapping(value = "/downloadStaticFile", method= {RequestMethod.POST})
	public DataResponse saveCollect(@RequestBody SaveCollectRequest req,HttpServletRequest request) {
		DataResponse dataResponse = new DataResponse();
		/*String updateStr = aseReq.getUpdateStr();
//		String aeskey = request.getHeader(ResponseStatusEnum.HREAD_AES_KET.getCode());// aes加密后的key
//		log.info("===========saveCollect数据保存接口请求报文："+updateStr);
//		String decrypt="";
//		try {
//			decrypt = ASUtils.decrypt(updateStr, aeskey, ResponseStatusEnum.AES_KEY.getName());
//			log.info("解密后字符串："+decrypt);
//		} catch (Exception e1) {
//			e1.printStackTrace();
//			dataResponse.setCode(ResponseStatusEnum.AES_ERROR.getCode());
//			dataResponse.setMsg(ResponseStatusEnum.AES_ERROR.getName());
//			log.info("===========saveCollect数据保存接口返回报文："+JSONObject.toJSON(dataResponse).toString());
//			return dataResponse;
//		}*/
////		SaveCollectRequest req = JSON.parseObject(decrypt, SaveCollectRequest.class);
		
		log.info(req.getUuid()+"===========saveCollect数据采集接口请求开始===="+Calendar.getInstance().getTime()+"=="+JSONObject.toJSON(req).toString());
		if(null==req||null==req.getUuid()||req.getUuid().trim().length()<=0||
				req.getSystemCode()==null||req.getSystemCode().trim().length()<=0) {
			dataResponse.setCode(ResponseStatusEnum.PARAM_IS_NULL.getCode());
			dataResponse.setMsg(ResponseStatusEnum.PARAM_IS_NULL.getName());
			log.info(req.getUuid()+"===========saveCollect数据采集接口返回报文："+JSONObject.toJSON(dataResponse).toString());
			return dataResponse;
		}
		try {
			collectDataServiceImpl.saveData(req);
		} catch (Exception e) {
//			e.printStackTrace();
			dataResponse.setCode(ResponseStatusEnum.EXCEPTION.getCode());
			dataResponse.setMsg(ResponseStatusEnum.EXCEPTION.getName());
			log.info(req.getUuid()+"===========saveCollect数据采集接口返回报文："+JSONObject.toJSON(dataResponse).toString());
			return dataResponse;
		}
		dataResponse.setCode(ResponseStatusEnum.SUCCESS_CODE.getCode());
		dataResponse.setMsg(ResponseStatusEnum.SUCCESS_CODE.getName());
		log.info(req.getUuid()+"===========saveCollect数据采集接口返回报文："+JSONObject.toJSON(dataResponse).toString());
		return dataResponse;
	}


	/**
	 * 外部系统调用
	 * 数据更新接口
	 * @param
	 * @return
	 */
//	@RequestMapping(value="/nrrwebApi/updateCollect", method= {RequestMethod.POST}) 2020-11-23
	//,@RequestBody UpdateCollectReq req
//	@RequestMapping(value="/nrrwebApi/updateCollect", method= {RequestMethod.POST})
	@RequestMapping(value="/updateCollect", method= {RequestMethod.POST})
	public DataResponse nrrwebApiUpdateCollect(@RequestBody AseReq aseReq, HttpServletRequest request) {
		
		DataResponse dataResponse = new DataResponse();
		String updateStr = aseReq.getUpdateStr();
		String aeskey = request.getHeader(ResponseStatusEnum.HREAD_AES_KET.getCode());// aes加密后的key
		UpdateCollectReq req = new UpdateCollectReq();
			//加入解密过程
			log.info("===========updateCollect数据更新接口请求报文："+updateStr);
			String decrypt="";
			try {
				decrypt = ASUtils.decrypt(updateStr, aeskey, ResponseStatusEnum.AES_KEY.getName());
				log.info("解密后字符串："+decrypt);
			} catch (Exception e1) {
//			e1.printStackTrace();
				dataResponse.setCode(ResponseStatusEnum.AES_ERROR.getCode());
				dataResponse.setMsg(ResponseStatusEnum.AES_ERROR.getName());
				log.info("===========updateCollect数据更新接口返回报文："+JSONObject.toJSON(dataResponse).toString());
				return dataResponse;
			}
			req = JSON.parseObject(decrypt, UpdateCollectReq.class);
		int updateFlag = 0;
		log.info(req.getId()+"===========updateCollect数据更新接口请求解析报文："+JSONObject.toJSON(req).toString());
		if(null==req||null==req.getId()||req.getId().trim().length()<=0) {
			dataResponse.setCode(ResponseStatusEnum.PARAM_IS_NULL.getCode());
			dataResponse.setMsg(ResponseStatusEnum.PARAM_IS_NULL.getName());
			log.info(req.getId()+"===========updateCollect数据更新接口返回报文："+JSONObject.toJSON(dataResponse).toString());
			return dataResponse;
		}
		try {
			updateFlag = collectDataServiceImpl.updateData(req);
			
		} catch (Exception e) {
			log.error(e);
			dataResponse.setCode(ResponseStatusEnum.EXCEPTION.getCode());
			dataResponse.setMsg(ResponseStatusEnum.EXCEPTION.getName());
			log.info(req.getId()+"===========updateCollect数据更新接口返回报文："+JSONObject.toJSON(dataResponse).toString());
			return dataResponse;
		}
		if(updateFlag==0) {
			dataResponse.setCode(ResponseStatusEnum.NOT_DATA.getCode());
			dataResponse.setMsg(ResponseStatusEnum.NOT_DATA.getName());
			log.info(req.getId()+"===========updateCollect数据更新接口返回报文："+JSONObject.toJSON(dataResponse).toString());
			return dataResponse;
		}
		dataResponse.setCode(ResponseStatusEnum.SUCCESS_CODE.getCode());
		dataResponse.setMsg(ResponseStatusEnum.SUCCESS_CODE.getName());
		log.info(req.getId()+"===========updateCollect数据更新接口返回报文："+JSONObject.toJSON(dataResponse).toString());
		return dataResponse;
	}
	
	/**
	 * 数据更新接口
	 * @param req
	 * @return
	 */
//	@RequestMapping(value="/updateCollect", method= {RequestMethod.POST})
	public DataResponse updateCollect(@RequestBody UpdateCollectReq req,HttpServletRequest request) {
		
		DataResponse dataResponse = new DataResponse();
//		String updateStr = aseReq.getUpdateStr();
		String aeskey = request.getHeader(ResponseStatusEnum.HREAD_AES_KET.getCode());// aes加密后的key
//		log.info("===========updateCollect数据更新接口请求报文："+updateStr);
//		String decrypt="";
		/*try {
			decrypt = ASUtils.decrypt(updateStr, aeskey, ResponseStatusEnum.AES_KEY.getName());
			log.info("解密后字符串："+decrypt);
		} catch (Exception e1) {
			e1.printStackTrace();
			dataResponse.setCode(ResponseStatusEnum.AES_ERROR.getCode());
			dataResponse.setMsg(ResponseStatusEnum.AES_ERROR.getName());
			log.info("===========updateCollect数据更新接口返回报文："+JSONObject.toJSON(dataResponse).toString());
			return dataResponse;
		}*/
//		UpdateCollectReq req = JSON.parseObject(decrypt, UpdateCollectReq.class);
		int updateFlag = 0;
		log.info(req.getId()+"===========updateCollect数据更新接口请求解析报文："+JSONObject.toJSON(req).toString());
		if(null==req&&null==req.getId()&&req.getId().trim().length()<=0&&null==req.getQuery_id()
				&&req.getQuery_id().trim().length()<=0) {
			dataResponse.setCode(ResponseStatusEnum.PARAM_IS_NULL.getCode());
			dataResponse.setMsg(ResponseStatusEnum.PARAM_IS_NULL.getName());
			log.info(req.getId()+"===========updateCollect数据更新接口返回报文："+JSONObject.toJSON(dataResponse).toString());
			return dataResponse;
		}
		try {
			updateFlag = collectDataServiceImpl.updateData(req);
			
		} catch (Exception e) {
//			e.printStackTrace();
			log.error(e);
			dataResponse.setCode(ResponseStatusEnum.EXCEPTION.getCode());
			dataResponse.setMsg(ResponseStatusEnum.EXCEPTION.getName());
			log.info("===========updateCollect数据更新接口返回报文："+JSONObject.toJSON(dataResponse).toString());
			return dataResponse;
		}
		if(updateFlag==0) {
			dataResponse.setCode(ResponseStatusEnum.NOT_DATA.getCode());
			dataResponse.setMsg(ResponseStatusEnum.NOT_DATA.getName());
			log.info("===========updateCollect数据更新接口返回报文："+JSONObject.toJSON(dataResponse).toString());
			return dataResponse;
		}
		dataResponse.setCode(ResponseStatusEnum.SUCCESS_CODE.getCode());
		dataResponse.setMsg(ResponseStatusEnum.SUCCESS_CODE.getName());
		log.info("===========updateCollect数据更新接口返回报文："+JSONObject.toJSON(dataResponse).toString());
		return dataResponse;
	}

/*
	*/
/**
	 * TXT上传接口
	 * @param file
	 * @param
	 * @return
	 */
	@RequestMapping(value="/uploadTxt", method= {RequestMethod.POST})
	public DataResponse uploadTxt(@RequestParam("file") MultipartFile file,@RequestParam("aseString")String aseString,HttpServletRequest request){
//	public DataResponse uploadTxt(@RequestParam("file") MultipartFile file,UpdateCollectReq req){
		//1、解密字符串得到UpdateCollectReq req对象
		DataResponse dataResponse = new DataResponse();
		//判断文件是否为空
		if (file.isEmpty()) {
			//上传文件为null
			dataResponse.setCode(ResponseStatusEnum.UPLOADTXTFAIL.getCode());
			dataResponse.setMsg(ResponseStatusEnum.UPLOADTXTFAIL.getName()+"没有上传TXT文件");
			return dataResponse;
		}
		UpdateCollectReq req=new UpdateCollectReq();
		String aeskey = request.getHeader(ResponseStatusEnum.HREAD_AES_KET.getCode());//aes解密使用的key的密文
		String decrypt="";
		try{
			decrypt=ASUtils.decrypt(aseString,aeskey,ResponseStatusEnum.AES_KEY.getName());
		}catch (Exception e){
			dataResponse.setCode(ResponseStatusEnum.AES_ERROR.getCode());
			dataResponse.setMsg(ResponseStatusEnum.AES_ERROR.getName());
			log.info("txt上传解密失败");
			return dataResponse;
		}
		req=JSON.parseObject(decrypt,UpdateCollectReq.class);
		log.info("======================txt上传开始===========================");
		int uploadFlag = 0;
		String buffer = "";

		//解析TXT内容
		log.info("解析TXT内容开始");
		if (!file.getOriginalFilename().endsWith(".txt")){
			//输出文件格式有问题
			log.info("上传文件格式不是txt文件");
			dataResponse.setCode(ResponseStatusEnum.UPLOADTXTFAIL.getCode());
			dataResponse.setMsg(ResponseStatusEnum.UPLOADTXTFAIL.getName()+"上传文件格式不是TXT文件");
			return dataResponse;
		}else{
			try{
				InputStreamReader read = new InputStreamReader((file.getInputStream()),"UTF-8");
				BufferedReader bufferedReader = new BufferedReader(read);
				String readerStr = null;
				while((readerStr = bufferedReader.readLine()) != null){
					 buffer = buffer + readerStr;
				}
				read.close();
				log.info("解析TXT内容的内容是"+ buffer);
			}catch(Exception e){
				log.info("解析TXT失败，结束上传TXT后续存储操作");
				dataResponse.setCode(ResponseStatusEnum.FAIL_CODE.getCode());
				dataResponse.setMsg(ResponseStatusEnum.FAIL_CODE.getName()+"解析TXT失败");
				return dataResponse;
			}
		}
		log.info("解析TXT内容结束");
		//service层调用uploadTxt方法
		uploadFlag=collectDataServiceImpl.uploadTxt(buffer,req);
		if(uploadFlag==0){
			dataResponse.setCode(ResponseStatusEnum.NOT_DATA.getCode());
			dataResponse.setMsg(ResponseStatusEnum.NOT_DATA.getName()+"txt中数据是无效数据");
			log.info("txt文件上传时，传入的更新数据是无效数据，接入系统里面没有"+JSONObject.toJSON(dataResponse).toString());
			return dataResponse;
		}
		if(uploadFlag==-1){
			log.info("txt上传的时候save出异常了");
			dataResponse.setCode(ResponseStatusEnum.UPLOADTXTFAIL.getCode());
			dataResponse.setMsg(ResponseStatusEnum.UPLOADTXTFAIL.getName()+"	"+"txt上传的时候save出异常了");
			return dataResponse;
		}
		if(uploadFlag==-2){
			log.info("txt上传的时候update出异常了");
			dataResponse.setCode(ResponseStatusEnum.UPLOADTXTFAIL.getCode());
			dataResponse.setMsg(ResponseStatusEnum.UPLOADTXTFAIL.getName()+"	"+"txt上传的时候update出异常了");
			return dataResponse;
		}
		dataResponse.setCode(ResponseStatusEnum.SUCCESS_CODE.getCode());
		dataResponse.setMsg(ResponseStatusEnum.SUCCESS_CODE.getName()+"txt上传成功");
		return dataResponse;
	}

	/**
	 * zip包上传
	 * @param file
	 * @param
	 * @return
	 */
	public DataResponse uploadZip(@RequestParam("filezip") MultipartFile file,@RequestParam("aseString")String aseString,HttpServletRequest request)  {
		DataResponse dataResponse = new DataResponse();
		String aeskey = request.getHeader(ResponseStatusEnum.HREAD_AES_KET.getCode());//aes解密使用的key的密文
		String reqJson="";
		try {
			reqJson=ASUtils.decrypt(aseString,aeskey,ResponseStatusEnum.AES_KEY.getName());
		} catch (Exception e) {
			dataResponse.setCode(ResponseStatusEnum.AES_ERROR.getCode());
			dataResponse.setMsg(ResponseStatusEnum.AES_ERROR.getName());
			log.info("zip上传解密失败");
			return dataResponse;
		}
//		传入的update数组变为java对象
		List<UpdateCollectReq> req = JSONObject.parseArray(reqJson, UpdateCollectReq.class);
		if (file.isEmpty()) {
			//上传文件为null
			dataResponse.setCode(ResponseStatusEnum.FAIL_CODE.getCode());
			dataResponse.setMsg(ResponseStatusEnum.FAIL_CODE.getName()+"没有上传zip包文件");
			return dataResponse;
		}
		//判断是否是zip文件
		if (!file.getOriginalFilename().endsWith(".zip")){
			dataResponse.setCode(ResponseStatusEnum.FAIL_CODE.getCode());
			dataResponse.setMsg(ResponseStatusEnum.FAIL_CODE.getName()+"上传的文件不是zip包文件");
			return dataResponse;
		}
		//保存zip文件
		String fileName = file.getOriginalFilename();
		String diruuid=UUID.randomUUID().toString();
		String path = jieyapath+diruuid+"/";//zip的解压目录
		File dir = new File(path);
		if (!dir.exists()) {
			dir.mkdirs();
		}
		String filePath = lingshibaocun+diruuid+"/";//zip的临时保存目录
//		String filePath = "d:/test/"+diruuid+"/";//zip的临时保存目录
		File fileDir = new File(filePath);
		if (!fileDir.exists()) {
			fileDir.mkdirs();
		}
		File saveFile = new File(fileDir, fileName);//将压缩包解析到指定位置
		try {
			file.transferTo(saveFile);//保存压缩包
		} catch (IOException e) {
			log.info("zip包接收失败，后端没接收到zip包");
			dataResponse.setCode(ResponseStatusEnum.FAIL_CODE.getCode());
			dataResponse.setMsg(ResponseStatusEnum.FAIL_CODE.getName()+"	"+"zip包接收失败，此次zip包上传失败");
			CollectDataServiceImpl.deleteAll(new File(path));
			CollectDataServiceImpl.deleteAll(new File(filePath));
			return dataResponse;
		}
		//zip包解压
		try {
			CollectDataServiceImpl.unZipFiles(saveFile,path);
		} catch (IOException e) {
			log.info("zip包解压失败");
			dataResponse.setCode(ResponseStatusEnum.FAIL_CODE.getCode());
			dataResponse.setMsg(ResponseStatusEnum.FAIL_CODE.getName()+"	"+"zip包解压失败，此次zip包上传失败");
			CollectDataServiceImpl.deleteAll(new File(path));
			CollectDataServiceImpl.deleteAll(new File(filePath));
			return dataResponse;
		}

		int uploadFlag = 0;
		//zip解压后文件夹名字
		String zipEntryName="";
		zipEntryName = getZipName(saveFile, zipEntryName);

		if(zipEntryName!=null&&zipEntryName.indexOf("/")!=-1){
			zipEntryName=zipEntryName.substring(0,zipEntryName.indexOf("/"));
		}else{
			zipEntryName="";
		}

//		uploadFlag =collectDataServiceImpl.uploadZip(path+zipEntryName,req,path,filePath);
		if(uploadFlag==1){
			log.info("zip是空的文件夹");
			dataResponse.setCode(ResponseStatusEnum.FAIL_CODE.getCode());
			dataResponse.setMsg(ResponseStatusEnum.FAIL_CODE.getName()+"	"+"zip是空的文件夹，此次zip包上传失败");
			CollectDataServiceImpl.deleteAll(new File(path));
			CollectDataServiceImpl.deleteAll(new File(filePath));
			return dataResponse;
		}

		if(uploadFlag==2){
			log.info("zip里面文件格式不对，里面必须都是txt文件");
			dataResponse.setCode(ResponseStatusEnum.FAIL_CODE.getCode());
			dataResponse.setMsg(ResponseStatusEnum.FAIL_CODE.getName()+"	"+"zip里面文件格式不对，里面必须都是txt文件，此次zip包上传失败");
			CollectDataServiceImpl.deleteAll(new File(path));
			CollectDataServiceImpl.deleteAll(new File(filePath));
			return dataResponse;
		}

		if(uploadFlag==3){
			log.info("zip包里面有不合规的txt文件，空TXT");
			dataResponse.setCode(ResponseStatusEnum.FAIL_CODE.getCode());
			dataResponse.setMsg(ResponseStatusEnum.FAIL_CODE.getName()+"	"+"zip包里面有不合规的txt文件，空TXT，此次zip包上传失败");
			CollectDataServiceImpl.deleteAll(new File(path));
			CollectDataServiceImpl.deleteAll(new File(filePath));
			return dataResponse;
		}
		if(uploadFlag==4){
			log.info("savejson数据转换失败，此次上传zip包失败");
			dataResponse.setCode(ResponseStatusEnum.FAIL_CODE.getCode());
			dataResponse.setMsg(ResponseStatusEnum.FAIL_CODE.getName()+"	"+"savejson数据转换失败，此次上传zip包失败");
			CollectDataServiceImpl.deleteAll(new File(path));
			CollectDataServiceImpl.deleteAll(new File(filePath));
			return dataResponse;
		}
		if(uploadFlag==5){
			log.info("zip包的saveData失败，此次上传zip包失败");
			dataResponse.setCode(ResponseStatusEnum.FAIL_CODE.getCode());
			dataResponse.setMsg(ResponseStatusEnum.FAIL_CODE.getName()+"	"+"zip包的saveData失败，此次上传zip包失败");
			CollectDataServiceImpl.deleteAll(new File(path));
			CollectDataServiceImpl.deleteAll(new File(filePath));
			return dataResponse;
		}
		if(uploadFlag==6){
			log.info("zip上传updateData的传参有问题");
			dataResponse.setCode(ResponseStatusEnum.FAIL_CODE.getCode());
			dataResponse.setMsg(ResponseStatusEnum.FAIL_CODE.getName()+"	"+"zip上传updateData的传参有问题");
			CollectDataServiceImpl.deleteAll(new File(path));
			CollectDataServiceImpl.deleteAll(new File(filePath));
			return dataResponse;
		}
		if(uploadFlag==7){
			log.info("zip包的saveData失败，此次上传zip包失败");
			dataResponse.setCode(ResponseStatusEnum.FAIL_CODE.getCode());
			dataResponse.setMsg(ResponseStatusEnum.FAIL_CODE.getName()+"	"+"zip包的saveData失败，此次上传zip包失败");
			CollectDataServiceImpl.deleteAll(new File(path));
			CollectDataServiceImpl.deleteAll(new File(filePath));
			return dataResponse;
		}
		if(uploadFlag==8){
			log.info("allZip中update的传参有问题,原因aseString不能转成java对象");
			dataResponse.setCode(ResponseStatusEnum.FAIL_CODE.getCode());
			dataResponse.setMsg(ResponseStatusEnum.FAIL_CODE.getName()+"	"+"zip包的saveData失败，此次上传zip包失败");
			CollectDataServiceImpl.deleteAll(new File(path));
			CollectDataServiceImpl.deleteAll(new File(filePath));
			return dataResponse;
		}
		dataResponse.setCode(ResponseStatusEnum.SUCCESS_CODE.getCode());
		dataResponse.setMsg(ResponseStatusEnum.SUCCESS_CODE.getName()+"	"+"zip包上传成功");
		return dataResponse;
	}

	private String getZipName(File saveFile, String zipEntryName) {
		try {
			ZipFile zip = new ZipFile(saveFile, Charset.forName("GBK"));
			Enumeration<? extends ZipEntry> entries = zip.entries();
			if(entries.hasMoreElements()){
				ZipEntry entry = (ZipEntry) entries.nextElement();
				//entry.getName()获取文件相对zip包的路径
				 zipEntryName = entry.getName();
			}

		} catch (IOException e) {

		}
		return zipEntryName;
	}


	/**
	 * 视频回放接口
	 * @param req 
	 * @return
	 */
	@RequestMapping(value="/queryDataFile", method= {RequestMethod.POST})
	public DataCollectResponse queryDataFile(@RequestBody UpdateCollectReq req,HttpServletRequest request) {
		
		log.info("===========queryDataFile视频回放接口请求报文："+JSONObject.toJSON(req).toString());
		DataCollectResponse dataResponse = new DataCollectResponse();
		if(null==req||null==req.getId()||req.getId().trim().length()<=0) {
			dataResponse.setCode(ResponseStatusEnum.PARAM_IS_NULL.getCode());
			dataResponse.setMsg(ResponseStatusEnum.PARAM_IS_NULL.getName());
			log.info("===========queryDataFile视频回放接口返回报文："+JSONObject.toJSON(dataResponse).toString());
			return dataResponse;
		}
		List strList = new ArrayList<String>();
		List userList = null;
		DataCollect dataCollect = null;
		try {
			//查询播放数据信息
			strList = collectDataServiceImpl.queryDataFile(req);
			//查询播放人员历史信息
			userList =  collectDataServiceImpl.queryUserList(req.getId(), request);
			dataCollect = collectDataServiceImpl.queryPluginData(req.getId(), req.getBusinessNo());
		} catch (Exception e) {
//			e.printStackTrace();
			log.error(e);
			dataResponse.setCode(ResponseStatusEnum.EXCEPTION.getCode());
			dataResponse.setMsg(ResponseStatusEnum.EXCEPTION.getName());
			log.info("===========queryDataFile视频回放接口返回报文："+JSONObject.toJSON(dataResponse).toString());
			return dataResponse;
		}
		if(dataCollect!=null) {
			dataResponse.setId(dataCollect.getId());
			dataResponse.setPluginName(dataCollect.getPluginName());
			dataResponse.setPluginVersion(dataCollect.getPluginVersion());
		}
		dataResponse.setCode(ResponseStatusEnum.SUCCESS_CODE.getCode());
		dataResponse.setMsg(ResponseStatusEnum.SUCCESS_CODE.getName());
		dataResponse.setData(strList);
		dataResponse.setUserList(userList);
		log.info("===========queryDataFile视频回放接口返回成功：id="+req.getId());
		return dataResponse;
	}
	
	/**
	 * 视频回放列表查询
	 * @param req 
	 * @return
	 */
	@RequestMapping(value="/queryDataList", method= {RequestMethod.POST})
	public PageResponse queryDataList(@RequestBody UpdateCollectReq req,HttpServletRequest request) {
		
		log.info("===========queryDataList视频回放列表查询接口请求报文："+JSONObject.toJSON(req).toString());
		PageResponse pageResponse = new PageResponse();
		PageCount pageCount = new PageCount();
		try {
			//获取session中的用户机构代码DEPT_NO
			UserSessionBo user = (UserSessionBo) request.getSession().getAttribute("user");
			String deptNo = user.getDeptNo();
			log.info("获取session中的用户机构代码DEPT_NO"+deptNo);
			pageCount = collectDataServiceImpl.queryDataList(req,deptNo);
		} catch (Exception e) {
//			e.printStackTrace();
			log.error(e);
			pageResponse.setCode(ResponseStatusEnum.EXCEPTION.getCode());
			pageResponse.setMsg(ResponseStatusEnum.EXCEPTION.getName());
			log.info("===========queryDataList视频回放列表查询接口返回报文："+JSONObject.toJSON(pageResponse).toString());
			return pageResponse;
		}
		pageResponse.setCode(ResponseStatusEnum.SUCCESS_CODE.getCode());
		pageResponse.setMsg(ResponseStatusEnum.SUCCESS_CODE.getName());
		pageResponse.setPageCount(pageCount);
		log.info("===========queryDataList视频回放列表查询接口返回成功=========");
		return pageResponse;
	}
	
	/**
	 * 日期对比接口  有token
	 * @return
	 */
//	@RequestMapping(value="/compareSysTime", method= {RequestMethod.POST})
	public CompareSysTimeRes compareSysTime(@RequestBody CompareSysTimeReq req) {
		CompareSysTimeRes res = new CompareSysTimeRes();
		log.info("===========compareSysTime日期对比接口请求报文："+JSONObject.toJSON(req).toString());
		if(null==req||0==req.getSysTime()) {
			res.setResponseHeadDto(new ResponseHeadDto(BaseResult1.AUTH_ERROR, "入参时间为0"));
			res.setFlag(false);
			return res;
		}
		log.info("获取token开始...");
		//生成token
		String access_token = UUID.randomUUID().toString().replace("-", "");
		redisUtil.setStr(access_token, access_token);
		redisUtil.setExpire(access_token, 30*60*1000);
		log.info("token存入redis完成");
		// redis中token已失效，保存新token并返回
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
		Calendar c = Calendar.getInstance();
		c.setTimeInMillis(req.getSysTime());
		String paramDate = sdf.format(c.getTime());
		String nowTime = sdf.format(new Date());
		log.info("SysTime:  "+paramDate);
		log.info("nowTime	"+nowTime);
		if(paramDate.equals(nowTime)) {
			res.setResponseHeadDto(new ResponseHeadDto(BaseResult1.SUCCESS, "获取成功"));
			res.setFlag(true);
			res.setToken(access_token);
			return res;
		}
		res.setResponseHeadDto(new ResponseHeadDto(BaseResult1.SYS_ERROR, "获取失败"));
		res.setFlag(false);
		log.info("===========compareSysTime日期对比接口返回报文："+JSONObject.toJSON(res).toString());
		return res;
	}



	/**
	 * 日期对比接口  无token
	 * @return
	 */
	/*@RequestMapping(value="/compareSysTime", method= {RequestMethod.POST})
	public boolean compareSysTime(@RequestBody CompareSysTimeReq req) {
		
		log.info("===========compareSysTime日期对比接口请求报文："+JSONObject.toJSON(req).toString());
		if(null==req||0==req.getSysTime()) {
			return false;
		}
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
		Calendar c = Calendar.getInstance();
		c.setTimeInMillis(req.getSysTime());
		String paramDate = sdf.format(c.getTime());
		String nowTime = sdf.format(new Date());
		if(paramDate.equals(nowTime)) {
			log.info("===========compareSysTime日期对比接口返回true========");
			return true;
		}
		log.info("===========compareSysTime日期对比接口返回false========");
		return false;
	}*/
	
	/**
	 * 加密
	 * @param request
	 * @param response
	 * @param aseReq
	 * @return
	 */
	@ResponseBody
//	@RequestMapping(value = "/nrrwebApi/addTrack")
//	@RequestMapping(value = "/nrrwebApi/addTrack") 2020-11-23  ,@RequestBody TrackBo bo
	@RequestMapping(value = "/addTrack")
	public DataResponse nrrwebApiAddArchive(HttpServletRequest request, HttpServletResponse response, @RequestBody AseReq aseReq){
		DataResponse dataResponse = new DataResponse();
		String updateStr = aseReq.getUpdateStr();
		String aeskey = request.getHeader(ResponseStatusEnum.HREAD_AES_KET.getCode());// aes加密后的key
		TrackBo bo=new TrackBo();
			log.info("===========addTrack数据保存接口请求报文："+updateStr);
			String decrypt="";
			try {
				decrypt = ASUtils.decrypt(updateStr, aeskey, ResponseStatusEnum.AES_KEY.getName());
				log.info("解密后字符串："+decrypt);
			} catch (Exception e1) {
//			e1.printStackTrace();
				dataResponse.setCode(ResponseStatusEnum.AES_ERROR.getCode());
				dataResponse.setMsg(ResponseStatusEnum.AES_ERROR.getName());
				log.info("===========addTrack数据保存接口返回报文："+JSONObject.toJSON(dataResponse).toString());
				return dataResponse;
			}
			bo = JSON.parseObject(decrypt, TrackBo.class);

		try {
			dataResponse = collectDataServiceImpl.insertTrack(bo);
		} catch (Exception e) {
//			e.printStackTrace();
			log.error(e);
			dataResponse.setCode(ResponseStatusEnum.EXCEPTION.getCode());
			dataResponse.setMsg(ResponseStatusEnum.EXCEPTION.getName() + "；" + e.getMessage());
		}
		return dataResponse;
	}
//	@ResponseBody
//	@RequestMapping(value = "/addTrack")
	public DataResponse addArchive(HttpServletRequest request, HttpServletResponse response, @RequestBody TrackBo bo){
		DataResponse dataResponse = new DataResponse();
		/*String updateStr = aseReq.getUpdateStr();
		String aeskey = request.getHeader(ResponseStatusEnum.HREAD_AES_KET.getCode());// aes加密后的key
		log.info("===========addTrack数据保存接口请求报文："+updateStr);
		String decrypt="";
		try {
			decrypt = ASUtils.decrypt(updateStr, aeskey, ResponseStatusEnum.AES_KEY.getName());
			log.info("解密后字符串："+decrypt);
		} catch (Exception e1) {
			e1.printStackTrace();
			dataResponse.setCode(ResponseStatusEnum.AES_ERROR.getCode());
			dataResponse.setMsg(ResponseStatusEnum.AES_ERROR.getName());
			log.info("===========addTrack数据保存接口返回报文："+JSONObject.toJSON(dataResponse).toString());
			return dataResponse;
		}
		TrackBo bo = JSON.parseObject(decrypt, TrackBo.class);*/
		
		try {
			dataResponse = collectDataServiceImpl.insertTrack(bo);
		} catch (Exception e) {
//			e.printStackTrace();
			log.error(e);
			dataResponse.setCode(ResponseStatusEnum.EXCEPTION.getCode());
			dataResponse.setMsg(ResponseStatusEnum.EXCEPTION.getName() + "；" + e.getMessage());
		}
		return dataResponse;
	}
	
	@ResponseBody
	@RequestMapping(value = "/queryTrackByCollectId")
	public DataResponse queryTrackByCollectId(HttpServletRequest request, HttpServletResponse response, @RequestBody TrackBo bo){
		
		DataResponse dataResponse = new DataResponse();
		try {
			dataResponse = collectDataServiceImpl.queryTrackByCollectId(bo);
		} catch (Exception e) {
//			e.printStackTrace();
			log.error(e);
			dataResponse.setCode(ResponseStatusEnum.EXCEPTION.getCode());
			dataResponse.setMsg(ResponseStatusEnum.EXCEPTION.getName() + "；" + e.getMessage());
		}
		return dataResponse;
	}
	
	/**
	 * 完成录制接口 外部调用
	 * @param req 
	 * @return
	 */
	@RequestMapping(value="/finishRecord", method= {RequestMethod.POST})
	public DataResponse finishRecord(@RequestBody SaveCollectRequest req) {
		
		log.info("===========finishRecord录制完成接口请求开始===="+JSONObject.toJSON(req).toString());
		DataResponse dataResponse = new DataResponse();
		//业务号不能为空
		if(null==req||null==req.getBusinessNo()||req.getBusinessNo().trim().length()<=0) {
			dataResponse.setCode(ResponseStatusEnum.PARAM_IS_NULL.getCode());
			dataResponse.setMsg(ResponseStatusEnum.PARAM_IS_NULL.getName());
			log.info("===========finishRecord录制完成接口返回报文："+JSONObject.toJSON(dataResponse).toString());
			return dataResponse;
		}
		try {
			return collectDataServiceImpl.finishRecord(req);
		} catch (Exception e) {
//			e.printStackTrace();
			log.error(e);
			dataResponse.setCode(ResponseStatusEnum.EXCEPTION.getCode());
			dataResponse.setMsg(ResponseStatusEnum.EXCEPTION.getName());
			log.info("===========finishRecord录制完成接口返回报文："+JSONObject.toJSON(dataResponse).toString());
			return dataResponse;
		}
	}
	
	@ResponseBody
	@RequestMapping(value = "/queryRecord")
	public DataResponse queryApplyRecord(@RequestBody UpdateCollectReq req){
		
		DataResponse dataResponse = new DataResponse();
		try {
			dataResponse = collectDataServiceImpl.queryApplyRecord(req);
		} catch (Exception e) {
//			e.printStackTrace();
			log.error(e);
			dataResponse.setCode(ResponseStatusEnum.EXCEPTION.getCode());
			dataResponse.setMsg(ResponseStatusEnum.EXCEPTION.getName() + "；" + e.getMessage());
		}
		return dataResponse;
	}
	
	/**
	 * 保存html文件
	 * @return
	 */
	@RequestMapping(value = "/saveHtmlData", method= {RequestMethod.POST})
	public DataResponse saveHtmlData(@RequestBody SaveCollectRequest req) {
		
//		String url = "file:///var/mobile/Containers/Data/Application/EDBF76EC-A9FE-496B-A286-F19B31A794B9/Documents/web/CommonWeb/css/mBank.css";
//		int num = url.indexOf("/CommonWeb");
//		url = url.substring(num,url.length());
//		url ="https://www.bjnfbk.com" +url;
//		log.info(url);
		
		log.info("===========saveHtmlData保存html接口请求报文："+JSONObject.toJSON(req).toString());
		DataResponse dataResponse = new DataResponse();
		if(null==req||null==req.getSystemCode()||req.getSystemCode().trim().length()<=0||null==req.getHtmlArray()||req.getHtmlArray().size()<=0
				||req.getLinkArray()==null||req.getLinkArray().size()<=0) {
			dataResponse.setCode(ResponseStatusEnum.PARAM_IS_NULL.getCode());
			dataResponse.setMsg(ResponseStatusEnum.PARAM_IS_NULL.getName());
			log.info("===========saveHtmlData保存html接口返回报文："+JSONObject.toJSON(dataResponse).toString());
			return dataResponse;
		}
		try {
			collectDataServiceImpl.downloadFile(req);
		} catch (Exception e) {
//			e.printStackTrace();
			log.error(e);
			dataResponse.setCode(ResponseStatusEnum.EXCEPTION.getCode());
			dataResponse.setMsg(ResponseStatusEnum.EXCEPTION.getName());
			log.info("===========saveHtmlData保存html接口返回报文："+JSONObject.toJSON(dataResponse).toString());
			return dataResponse;
		}
		
		dataResponse.setCode(ResponseStatusEnum.SUCCESS_CODE.getCode());
		dataResponse.setMsg(ResponseStatusEnum.SUCCESS_CODE.getName());
		log.info("===========saveHtmlData保存html接口返回报文："+JSONObject.toJSON(dataResponse).toString());
		return dataResponse;
	}
	
	/**
	 * 查询文件ETag\last-Modify
	 * @param req
	 * @return
	 */
//	@RequestMapping(value = "/compareHtml", method= {RequestMethod.POST})
	public DataResponse compareHtml(@RequestBody SaveCollectRequest req) {
		
		log.info("===========compareHtml查询html参数接口请求报文："+JSONObject.toJSON(req).toString());
		DataResponse dataResponse = new DataResponse();
		if(null==req||null==req.getSystemCode()||req.getSystemCode().trim().length()<=0) {
			dataResponse.setCode(ResponseStatusEnum.PARAM_IS_NULL.getCode());
			dataResponse.setMsg(ResponseStatusEnum.PARAM_IS_NULL.getName());
			log.info("===========compareHtml查询html参数接口返回报文："+JSONObject.toJSON(dataResponse).toString());
			return dataResponse;
		}
		try {
			dataResponse = collectDataServiceImpl.compare(req);
			log.info("===========compareHtml查询html参数接口返回报文："+JSONObject.toJSON(dataResponse).toString());
			return dataResponse;
		} catch (Exception e) {
			log.error(e);
			dataResponse.setCode(ResponseStatusEnum.EXCEPTION.getCode());
			dataResponse.setMsg(ResponseStatusEnum.EXCEPTION.getName());
			log.info("===========compareHtml查询html参数接口返回报文："+JSONObject.toJSON(dataResponse).toString());
		}
		return dataResponse;
	}
	

	
	/**
	 * 判断是否比对
	 * @param req
	 * @return
	 */
//	@RequestMapping(value = "/isNotCompare", method= {RequestMethod.POST})
	public DataResponse isNotCompare(@RequestBody SaveCollectRequest req) {

		log.info("===========isNotCompare接口请求报文："+JSONObject.toJSON(req).toString());
		DataResponse dataResponse = new DataResponse();
		//暂时改为全比对
		dataResponse.setCode(ResponseStatusEnum.COMPARE.getCode());//默认302
		dataResponse.setMsg(ResponseStatusEnum.COMPARE.getName());
		//暂时改为全比对
		if(null==req||null==req.getSystemCode()||req.getSystemCode().trim().length()<=0) {
			dataResponse.setCode(ResponseStatusEnum.PARAM_IS_NULL.getCode());
			dataResponse.setMsg(ResponseStatusEnum.PARAM_IS_NULL.getName());
			log.info("===========isNotCompare接口返回报文："+JSONObject.toJSON(dataResponse).toString());
			return dataResponse;
		}
		try {
//			dataResponse = collectDataServiceImpl.isNotCompareHtml(req.getSystemCode());
			log.info("===========isNotCompare接口返回报文："+JSONObject.toJSON(dataResponse).toString());
		} catch (Exception e) {
//			e.printStackTrace();
			log.error(e);
			dataResponse.setCode(ResponseStatusEnum.EXCEPTION.getCode());
			dataResponse.setMsg(ResponseStatusEnum.EXCEPTION.getName());
			log.info("===========isNotCompare接口返回报文："+JSONObject.toJSON(dataResponse).toString());
			return dataResponse;
		}
		return dataResponse;
	}
	
	/**
	 * 下载静态资源
	 * @param req
	 * @return
	 * /
	 */
	/*@RequestMapping(value="/saveCollect", method= {RequestMethod.POST})*/
//	@RequestMapping(value = "/downloadStaticFile", method= {RequestMethod.POST})
	public DataResponse downloadStaticFile(@RequestBody SaveCollectRequest req) {
		log.info("===========downloadStaticFile接口请求报文："+JSONObject.toJSON(req).toString());
		DataResponse dataResponse = new DataResponse();
		if(null==req||null==req.getSystemCode()||req.getSystemCode().trim().length()<=0) {
			dataResponse.setCode(ResponseStatusEnum.PARAM_IS_NULL.getCode());
			dataResponse.setMsg(ResponseStatusEnum.PARAM_IS_NULL.getName());
			log.info("===========downloadStaticFile接口返回报文："+JSONObject.toJSON(dataResponse).toString());
			return dataResponse;
		}
		try {
			dataResponse = collectDataServiceImpl.downloadStaticFile(req);
			log.info("===========downloadStaticFile接口返回报文："+JSONObject.toJSON(dataResponse).toString());
			return dataResponse;
		} catch (Exception e) {
			log.error(e);
			dataResponse.setCode(ResponseStatusEnum.EXCEPTION.getCode());
			dataResponse.setMsg(ResponseStatusEnum.EXCEPTION.getName());
			log.info("===========downloadStaticFile接口返回报文："+JSONObject.toJSON(dataResponse).toString());
		}
		return dataResponse;
	}
	@RequestMapping(value = "/downloadStaticFile", method= {RequestMethod.POST})
	public DataResponse nrrwebApidownloadStaticFile(@RequestBody AseReq aseReq,HttpServletRequest request){
		DataResponse dataResponse = new DataResponse();
		String updateStr = aseReq.getUpdateStr();
		String aeskey = request.getHeader(ResponseStatusEnum.HREAD_AES_KET.getCode());// aes加密后的key
		SaveCollectRequest req =new SaveCollectRequest();
		//解密过程
		log.info("===========downloadStaticFile数据保存接口请求报文："+updateStr);
		String decrypt="";
		try {
			decrypt = ASUtils.decrypt(updateStr, aeskey, ResponseStatusEnum.AES_KEY.getName());
			log.info("解密后字符串："+decrypt);
		} catch (Exception e1) {
			dataResponse.setCode(ResponseStatusEnum.AES_ERROR.getCode());
			dataResponse.setMsg(ResponseStatusEnum.AES_ERROR.getName());
			log.info("===========downloadStaticFile数据保存接口返回报文："+JSONObject.toJSON(dataResponse).toString());
			return dataResponse;
		}
		req = JSON.parseObject(decrypt, SaveCollectRequest.class);
		log.info("===========downloadStaticFile接口请求报文："+JSONObject.toJSON(req).toString());
		if(null==req||null==req.getSystemCode()||req.getSystemCode().trim().length()<=0) {
			dataResponse.setCode(ResponseStatusEnum.PARAM_IS_NULL.getCode());
			dataResponse.setMsg(ResponseStatusEnum.PARAM_IS_NULL.getName());
			log.info("===========downloadStaticFile接口返回报文："+JSONObject.toJSON(dataResponse).toString());
			return dataResponse;
		}
		try {
			dataResponse = collectDataServiceImpl.downloadStaticFile(req);
			log.info("===========downloadStaticFile接口返回报文："+JSONObject.toJSON(dataResponse).toString());
			return dataResponse;
		} catch (Exception e) {
			log.error(e);
			dataResponse.setCode(ResponseStatusEnum.EXCEPTION.getCode());
			dataResponse.setMsg(ResponseStatusEnum.EXCEPTION.getName());
			log.info("===========downloadStaticFile接口返回报文："+JSONObject.toJSON(dataResponse).toString());
		}
		return dataResponse;
	}


	@RequestMapping(value = "/compareHtml", method= {RequestMethod.POST})
	public DataResponse compareHtml1(@RequestBody AseReq aseReq,HttpServletRequest request) {

		DataResponse dataResponse = new DataResponse();
		String updateStr = aseReq.getUpdateStr();
		String aeskey = request.getHeader(ResponseStatusEnum.HREAD_AES_KET.getCode());// aes加密后的key
		SaveCollectRequest req =new SaveCollectRequest();
		log.info("===========compareHtml1数据保存接口请求报文："+updateStr);
		String decrypt="";
		try {
			decrypt = ASUtils.decrypt(updateStr, aeskey, ResponseStatusEnum.AES_KEY.getName());
			log.info("解密后字符串："+decrypt);
		} catch (Exception e1) {
			dataResponse.setCode(ResponseStatusEnum.AES_ERROR.getCode());
			dataResponse.setMsg(ResponseStatusEnum.AES_ERROR.getName());
			log.info("===========compareHtml1数据保存接口返回报文："+JSONObject.toJSON(dataResponse).toString());
			return dataResponse;
		}
		req = JSON.parseObject(decrypt, SaveCollectRequest.class);
		log.info("===========compareHtml1接口请求报文："+JSONObject.toJSON(req).toString());
		if(null==req||null==req.getSystemCode()||req.getSystemCode().trim().length()<=0) {
			dataResponse.setCode(ResponseStatusEnum.PARAM_IS_NULL.getCode());
			dataResponse.setMsg(ResponseStatusEnum.PARAM_IS_NULL.getName());
			log.info("===========compareHtml查询html参数接口返回报文："+JSONObject.toJSON(dataResponse).toString());
			return dataResponse;
		}
		try {
			dataResponse = collectDataServiceImpl.compare(req);
			log.info("===========compareHtml查询html参数接口返回报文："+JSONObject.toJSON(dataResponse).toString());
			return dataResponse;
		} catch (Exception e) {
			log.error(e);
			dataResponse.setCode(ResponseStatusEnum.EXCEPTION.getCode());
			dataResponse.setMsg(ResponseStatusEnum.EXCEPTION.getName());
			log.info("===========compareHtml查询html参数接口返回报文："+JSONObject.toJSON(dataResponse).toString());
		}
		return dataResponse;
	}


	@RequestMapping(value = "/isNotCompare", method= {RequestMethod.POST})
	public DataResponse isNotCompare1(@RequestBody AseReq aseReq,HttpServletRequest request) {
		DataResponse dataResponse = new DataResponse();
		String updateStr = aseReq.getUpdateStr();
		String aeskey = request.getHeader(ResponseStatusEnum.HREAD_AES_KET.getCode());// aes加密后的key
		SaveCollectRequest req =new SaveCollectRequest();
		log.info("===========isNotCompare1数据保存接口请求报文："+updateStr);
		String decrypt="";
		try {
			decrypt = ASUtils.decrypt(updateStr, aeskey, ResponseStatusEnum.AES_KEY.getName());
			log.info("解密后字符串："+decrypt);
		} catch (Exception e1) {
			dataResponse.setCode(ResponseStatusEnum.AES_ERROR.getCode());
			dataResponse.setMsg(ResponseStatusEnum.AES_ERROR.getName());
			log.info("===========isNotCompare1数据保存接口返回报文："+JSONObject.toJSON(dataResponse).toString());
			return dataResponse;
		}
		req = JSON.parseObject(decrypt, SaveCollectRequest.class);

		log.info("===========isNotCompare接口请求报文："+JSONObject.toJSON(req).toString());
		//暂时改为全比对
		dataResponse.setCode(ResponseStatusEnum.COMPARE.getCode());//默认302
		dataResponse.setMsg(ResponseStatusEnum.COMPARE.getName());
		//暂时改为全比对
		if(null==req||null==req.getSystemCode()||req.getSystemCode().trim().length()<=0) {
			dataResponse.setCode(ResponseStatusEnum.PARAM_IS_NULL.getCode());
			dataResponse.setMsg(ResponseStatusEnum.PARAM_IS_NULL.getName());
			log.info("===========isNotCompare接口返回报文："+JSONObject.toJSON(dataResponse).toString());
			return dataResponse;
		}
		try {
//			dataResponse = collectDataServiceImpl.isNotCompareHtml(req.getSystemCode());
			log.info("===========isNotCompare接口返回报文："+JSONObject.toJSON(dataResponse).toString());
		} catch (Exception e) {
//			e.printStackTrace();
			log.error(e);
			dataResponse.setCode(ResponseStatusEnum.EXCEPTION.getCode());
			dataResponse.setMsg(ResponseStatusEnum.EXCEPTION.getName());
			log.info("===========isNotCompare接口返回报文："+JSONObject.toJSON(dataResponse).toString());
			return dataResponse;
		}
		return dataResponse;
	}


	@RequestMapping(value="/compareSysTime", method= {RequestMethod.POST})
	//@RequestBody CompareSysTimeReq req
	public CompareSysTimeRes compareSysTime1(@RequestBody AseReq aseReq,HttpServletRequest request) {
		CompareSysTimeRes res = new CompareSysTimeRes();
		String updateStr = aseReq.getUpdateStr();
		String aeskey = request.getHeader(ResponseStatusEnum.HREAD_AES_KET.getCode());// aes加密后的key
		CompareSysTimeReq req =new CompareSysTimeReq();
		log.info("===========isNotCompare1数据保存接口请求报文："+updateStr);
		String decrypt="";
		try {
			decrypt = ASUtils.decrypt(updateStr, aeskey, ResponseStatusEnum.AES_KEY.getName());
			log.info("解密后字符串："+decrypt);
		} catch (Exception e1) {
			res.setResponseHeadDto(new ResponseHeadDto(BaseResult1.AUTH_ERROR, "获取时间解密失败"));
			res.setFlag(false);
			log.info("===========compareSysTime数据保存接口返回报文："+JSONObject.toJSON(res).toString());
			return res;
		}
		req = JSON.parseObject(decrypt, CompareSysTimeReq.class);
		log.info("===========compareSysTime日期对比接口请求报文："+JSONObject.toJSON(req).toString());
		if(null==req||0==req.getSysTime()) {
			res.setResponseHeadDto(new ResponseHeadDto(BaseResult1.AUTH_ERROR, "入参时间为0"));
			res.setFlag(false);
			return res;
		}
		log.info("获取token开始...");
		//生成token
		String access_token = UUID.randomUUID().toString().replace("-", "");
		redisUtil.setStr(access_token, access_token);
		redisUtil.setExpire(access_token, 30*60*1000);
		log.info("token存入redis完成");
		// redis中token已失效，保存新token并返回
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
		Calendar c = Calendar.getInstance();
		c.setTimeInMillis(req.getSysTime());
		String paramDate = sdf.format(c.getTime());
		String nowTime = sdf.format(new Date());
		log.info("SysTime:  "+paramDate);
		log.info("nowTime	"+nowTime);
		if(paramDate.equals(nowTime)) {
			res.setResponseHeadDto(new ResponseHeadDto(BaseResult1.SUCCESS, "获取成功"));
			res.setFlag(true);
			res.setToken(access_token);
			return res;
		}
		res.setResponseHeadDto(new ResponseHeadDto(BaseResult1.SYS_ERROR, "获取失败"));
		res.setFlag(false);
		log.info("===========compareSysTime日期对比接口返回报文："+JSONObject.toJSON(res).toString());
		return res;
	}

    @Autowired
    private DownLoadFile downfile;
	@Autowired
	private DataCollectMapper dataCollectMapper;
	@RequestMapping(value = "/redis", method= {RequestMethod.POST})
	public void redis(){
//		 List<DataCollect> dataCollects=dataCollectMapper.queryDataByIdList(idList);
		/*List<String> idList=new ArrayList<>();
		idList.add("0004ea26-b7a1-4eb5-99f4-8d35337e2629");
		idList.add("0013c735-a2dc-4265-824c-35d01937ff53");
		List<DataCollect> dataCollects=dataCollectMapper.queryDataByIdList(idList);
		System.out.println(JsonUtils.obj2Json(dataCollects));*/
		/*String s="{\"id\":\"df5172f3-ec66-4d9b-9fe4-a745d55beada\",\"businessNo\":\"00000000\",\"sysCode\":\"802-SCCBA\",\"organCode\":\"6.9.1\",\"versionNo\":\"6.9.1\",\"nowPage\":0,\"rowNum\":0,\"archiveUrl\":0,\"archiveTime\":0,\"equipmentId\":\"7d2fe1a77735d880e237f12bdafcb3afad700563a63c43b4a2127b6267e646c9\",\"exceptionId\":\"00000000\",\"phoneNumber\":\"18600442217\"}";
		UpdateCollectReq req = JsonUtils.json2Obj(s, UpdateCollectReq.class);
		try {
			int i = collectDataServiceImpl.updateData(req);
		} catch (Exception e) {
			e.printStackTrace();
		}*/

		try {
			String txtContent = getTxtContent("", new File("D:/zip/20210728_12123123.txt"),log);
			String[] split = txtContent.split(fengefu);
			for (String s : split) {
				DecrySaveReq decrySaveReq = JsonUtils.json2Obj(s, DecrySaveReq.class);
				SaveCollectRequest updateStr = decrySaveReq.getUpdateStr();
				try {
					collectDataServiceImpl.saveData(updateStr);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		} catch (IOException e) {
			e.printStackTrace();
		}


	}


	/**
	 * 上传单个txt的zip文件
	 * @param file
	 * @param aseString
	 * @param request
	 * @return
	 */
	@RequestMapping(value="/uploadSingleZip", method= {RequestMethod.POST})
	public DataResponse uploadSingleZip(@RequestParam("file") MultipartFile file,@RequestParam("aseString")String aseString,HttpServletRequest request){
		DataResponse dataResponse = new DataResponse();
		/**
		 * 1、非空判断==>上传的文件是不是空==>空的话告诉前端没有上传TXT文件的zip包
		 */
		if (file.isEmpty()) {
			dataResponse.setCode(ResponseStatusEnum.UPLOADTXTFAIL.getCode());
			dataResponse.setMsg(ResponseStatusEnum.UPLOADTXTFAIL.getName()+"没有上传TXT文件的zip包");
			return dataResponse;
		}
		/**
		 * 2、解析update的参数
		 */
		UpdateCollectReq req=new UpdateCollectReq();
		String aeskey = request.getHeader(ResponseStatusEnum.HREAD_AES_KET.getCode());//aes解密使用的key的密文
		String decrypt="";
		try{
			decrypt=ASUtils.decrypt(aseString,aeskey,ResponseStatusEnum.AES_KEY.getName());
		}catch (Exception e){
			dataResponse.setCode(ResponseStatusEnum.AES_ERROR.getCode());
			dataResponse.setMsg(ResponseStatusEnum.AES_ERROR.getName());
			log.info("txt上传解密失败");
			return dataResponse;
		}
		req=JSON.parseObject(decrypt,UpdateCollectReq.class);
		log.info("======================txt上传开始===========================");

		int uploadFlag = 0;
		/**
		 * 3、txt，获取txt里面内容
		 */
		String buffer = "";
		/**
		 * String fileName=file.getOriginalFilename();获取山东上传的zip包名称
		 */
		String fileName=file.getOriginalFilename();
		//接收zip包
		String diruuid=UUID.randomUUID().toString();
		String fileDirsinglezip=singlezip+diruuid+"/";
		File dir = new File(fileDirsinglezip);
		if (!dir.exists()) {
			dir.mkdirs();
		}
		File saveFile = new File(fileDirsinglezip, fileName);
		try {
			file.transferTo(saveFile);//保存压缩包
			log.info("SingleZip的临时保存路径"+saveFile.getAbsolutePath());
		} catch (IOException e) {
			//接收压缩包失败
			dataResponse.setCode(ResponseStatusEnum.UPLOADTXTFAIL.getCode());
			dataResponse.setMsg(ResponseStatusEnum.UPLOADTXTFAIL.getName()+"一个txt的zip包接收失败了");
			return dataResponse;
		}
		//获取zip文件名称,拿到解密zip包的秘钥
		String zipsecret=fileName.substring(0,fileName.indexOf(".zip"));
		log.info("SingleZip加密前"+zipsecret + encryptionsalt);
		String md5 = Md5Util1.getMd5(zipsecret + encryptionsalt);
		log.info("SingleZip解密秘钥"+md5);
		//解压zip包D：/zip/1.zip  ===>D:/zip
		try{
			CompressUtil.unZip(fileDirsinglezip+fileName,fileDirsinglezip,md5);
		}catch (Exception e){
			log.info("SingleZip中zip包解压失败");
			CollectDataServiceImpl.deleteAll(new File(fileDirsinglezip));
			dataResponse.setCode(ResponseStatusEnum.UPLOADTXTFAIL.getCode());
			dataResponse.setMsg(ResponseStatusEnum.UPLOADTXTFAIL.getName()+"SingleZip中zip包解压失败");
			return dataResponse;
		}

		//解析txt
		File file1=new File(fileDirsinglezip);
		List<File> fileList =new ArrayList<>();
		FileUtil.findFileList(file1,fileList);
		log.info("SingleZip获取zip里面txt成功，list的大小为"+fileList.size());
		File txtFile = fileList.get(0);
		try {
			buffer = getTxtContent(buffer, txtFile, log);
			log.info("SingleZip的Txt解析内容为："+buffer);
		} catch (IOException e) {
			log.info("SingleZip的Txt解析内容为失败");
			dataResponse.setCode(ResponseStatusEnum.FAIL_CODE.getCode());
			dataResponse.setMsg(ResponseStatusEnum.FAIL_CODE.getName()+"解析TXT失败");
			return dataResponse;
		}
		//删除zip包与txt
		CollectDataServiceImpl.deleteAll(new File(fileDirsinglezip));
		log.info("SingleZip此次上传的zip相关文件已经删除");
		//service层调用uploadTxt方法
		uploadFlag=collectDataServiceImpl.uploadTxt(buffer,req);
		if(uploadFlag==0){
			dataResponse.setCode(ResponseStatusEnum.NOT_DATA.getCode());
			dataResponse.setMsg(ResponseStatusEnum.NOT_DATA.getName()+"txt中数据是无效数据");
			log.info("txt文件上传时，传入的更新数据是无效数据，接入系统里面没有"+JSONObject.toJSON(dataResponse).toString());
			return dataResponse;
		}
		if(uploadFlag==-1){
			log.info("txt上传的时候save出异常了");
			dataResponse.setCode(ResponseStatusEnum.UPLOADTXTFAIL.getCode());
			dataResponse.setMsg(ResponseStatusEnum.UPLOADTXTFAIL.getName()+"	"+"txt上传的时候save出异常了");
			return dataResponse;
		}
		if(uploadFlag==-2){
			log.info("txt上传的时候update出异常了");
			dataResponse.setCode(ResponseStatusEnum.UPLOADTXTFAIL.getCode());
			dataResponse.setMsg(ResponseStatusEnum.UPLOADTXTFAIL.getName()+"	"+"txt上传的时候update出异常了");
			return dataResponse;
		}
		dataResponse.setCode(ResponseStatusEnum.SUCCESS_CODE.getCode());
		dataResponse.setMsg(ResponseStatusEnum.SUCCESS_CODE.getName()+"txt上传成功");
		return dataResponse;
	}

	/**
	 * 解析txt里内容变成字符串
	 * @param buffer
	 * @param txtFile
	 * @param log
	 * @return
	 */

	public static String getTxtContent(String buffer, File txtFile, Log log) throws IOException {

			InputStream inputStream = new FileInputStream(txtFile);
			InputStreamReader read = new InputStreamReader((inputStream),"UTF-8");
			BufferedReader bufferedReader = new BufferedReader(read);
			String readerStr = null;
			while((readerStr = bufferedReader.readLine()) != null){
				buffer = buffer + readerStr;
			}
			read.close();
			System.out.println("解析TXT内容的内容是"+ buffer);
		return buffer;
	}

	@RequestMapping(value="/uploadZip", method= {RequestMethod.POST})
	public DataResponse uploadZip1(@RequestParam("filezip") MultipartFile file,@RequestParam("aseString")String aseString,HttpServletRequest request)  {
		DataResponse dataResponse = new DataResponse();
		String aeskey = request.getHeader(ResponseStatusEnum.HREAD_AES_KET.getCode());//aes解密使用的key的密文
		String reqJson="";
		try {
			reqJson=ASUtils.decrypt(aseString,aeskey,ResponseStatusEnum.AES_KEY.getName());
			log.info("allZip中的aseString的json值为"+reqJson);
		} catch (Exception e) {
			dataResponse.setCode(ResponseStatusEnum.AES_ERROR.getCode());
			dataResponse.setMsg(ResponseStatusEnum.AES_ERROR.getName());
			log.info("allZip失败原因：接口传参aseString解密失败");
			return dataResponse;
		}
//		传入的update数组变为java对象
		List<UpdateCollectReq> req = new ArrayList<>();
		if (file.isEmpty()) {
			//上传文件为null
			dataResponse.setCode(ResponseStatusEnum.FAIL_CODE.getCode());
			dataResponse.setMsg(ResponseStatusEnum.FAIL_CODE.getName()+"没有上传zip包文件");
			return dataResponse;
		}
		//判断是否是zip文件
		if (!file.getOriginalFilename().endsWith(".zip")){
			dataResponse.setCode(ResponseStatusEnum.FAIL_CODE.getCode());
			dataResponse.setMsg(ResponseStatusEnum.FAIL_CODE.getName()+"上传的文件不是zip包文件");
			return dataResponse;
		}
		//保存zip文件
		String fileName = file.getOriginalFilename();
		String diruuid=UUID.randomUUID().toString();
		String path = jieyapath+diruuid+"/";//zip的解压目录
		File dir = new File(path);
		if (!dir.exists()) {
			dir.mkdirs();
		}
		String filePath = lingshibaocun+diruuid+"/";//zip的临时保存目录

		File fileDir = new File(filePath);
		if (!fileDir.exists()) {
			fileDir.mkdirs();
		}
		File saveFile = new File(fileDir, fileName);//将压缩包解析到指定位置
		try {
			file.transferTo(saveFile);//保存压缩包
		} catch (IOException e) {
			log.info("allZip失败原因：zip包接收的时候出现异常了");
			dataResponse.setCode(ResponseStatusEnum.FAIL_CODE.getCode());
			dataResponse.setMsg(ResponseStatusEnum.FAIL_CODE.getName()+"	"+"zip包接收失败，此次zip包上传失败");
			CollectDataServiceImpl.deleteAll(new File(path));
			CollectDataServiceImpl.deleteAll(new File(filePath));
			return dataResponse;
		}
		/**
		 * zip包解压
		 * =====>(1)获取加压zip包的秘钥
		 * =====>(2)将zip包解压到指定位置
		 * =====>(3)获取指定位置的所有zip文件,得到List<zipFile>数组 list
		 * =====>(4)list解压这些zip同时获取uuid，得到指定目录下所有txt文件数字
		 * =====>(5)获取所有txt集合
		 */
		String zipsecret = fileName.substring(0, fileName.indexOf(".zip"));
		log.info("allZip加密前"+zipsecret+encryptionsalt);
		String md5 = Md5Util1.getMd5(zipsecret + encryptionsalt);
		log.info("allZip解密秘钥"+md5);
		//String path = jieyapath+diruuid+"/";//zip的解压目录
		try {
			CompressUtil.unZip(saveFile.getAbsolutePath(),path,md5);
		}catch (Exception e){
			log.info("allZip将zip包解压到指定位置异常");
			dataResponse.setCode(ResponseStatusEnum.FAIL_CODE.getCode());
			dataResponse.setMsg(ResponseStatusEnum.FAIL_CODE.getName()+"	"+"allZip将zip包解压到指定位置异常");
			CollectDataServiceImpl.deleteAll(new File(path));
			CollectDataServiceImpl.deleteAll(new File(filePath));
			return dataResponse;
		}

		log.info("allZip将zip包解压到指定位置"+path);
		File contentZip=new File(path);

		List<File> zipList=new ArrayList<>();
		List<File> txtList=new ArrayList<>();
		List<String> uuidList=new ArrayList<>();
		FileUtil.findFileZipList(contentZip,zipList);
		log.info("allZip获取子zip包集合,集合个数为"+zipList.size());

		for (File file1 : zipList) {
			//获取uuid集合
			String name = file1.getName();
			String zipsecret1 = name.substring(0, name.indexOf(".zip"));//20210805_1111
			String uuid=zipsecret1.substring(zipsecret1.indexOf("_")+1);
			uuidList.add(uuid);
			//获取解密密码
			log.info("allZip子zip加密前"+zipsecret1+encryptionsalt);
			String md51 = Md5Util1.getMd5(zipsecret1 + encryptionsalt);
			log.info("allZip子zip解密秘钥"+md51);
			//解密所有zip包
			try{
				CompressUtil.unZip(file1.getAbsolutePath(),path,md51);
			}catch (Exception e){
				log.info("allZip所有子zip包解压异常");
				dataResponse.setCode(ResponseStatusEnum.FAIL_CODE.getCode());
				dataResponse.setMsg(ResponseStatusEnum.FAIL_CODE.getName()+"	"+"allZip所有子zip包解压异常");
				CollectDataServiceImpl.deleteAll(new File(path));
				CollectDataServiceImpl.deleteAll(new File(filePath));
				return dataResponse;
			}
		}
		log.info("allZip所有子zip包解密完成");

		FileUtil.findFileList(contentZip,txtList);
		log.info("allZip获取txt集合,集合个数为"+txtList.size());

		int uploadFlag = 0;
		uploadFlag =collectDataServiceImpl.uploadZip(txtList,req,path,filePath,uuidList,reqJson);
		if(uploadFlag==1){
			log.info("allZip失败原因：上传的zip包中里面子zip包都不行有txt文件");
			dataResponse.setCode(ResponseStatusEnum.FAIL_CODE.getCode());
			dataResponse.setMsg(ResponseStatusEnum.FAIL_CODE.getName()+"	"+"zip是空的文件夹，此次zip包上传失败");
			CollectDataServiceImpl.deleteAll(new File(path));
			CollectDataServiceImpl.deleteAll(new File(filePath));
			return dataResponse;
		}

		if(uploadFlag==2){
			log.info("allZip失败原因：zip里面文件格式不对，里面必须都是txt文件");
			dataResponse.setCode(ResponseStatusEnum.FAIL_CODE.getCode());
			dataResponse.setMsg(ResponseStatusEnum.FAIL_CODE.getName()+"	"+"zip里面文件格式不对，里面必须都是txt文件，此次zip包上传失败");
			CollectDataServiceImpl.deleteAll(new File(path));
			CollectDataServiceImpl.deleteAll(new File(filePath));
			return dataResponse;
		}

		if(uploadFlag==3){
			log.info("allZip失败原因：zip包里面有不合规的txt文件，空TXT");
			dataResponse.setCode(ResponseStatusEnum.FAIL_CODE.getCode());
			dataResponse.setMsg(ResponseStatusEnum.FAIL_CODE.getName()+"	"+"zip包里面有不合规的txt文件，空TXT，此次zip包上传失败");
			CollectDataServiceImpl.deleteAll(new File(path));
			CollectDataServiceImpl.deleteAll(new File(filePath));
			return dataResponse;
		}
		if(uploadFlag==4){
			log.info("savejson数据转换失败，此次上传zip包失败");
			dataResponse.setCode(ResponseStatusEnum.FAIL_CODE.getCode());
			dataResponse.setMsg(ResponseStatusEnum.FAIL_CODE.getName()+"	"+"savejson数据转换失败，此次上传zip包失败");
			CollectDataServiceImpl.deleteAll(new File(path));
			CollectDataServiceImpl.deleteAll(new File(filePath));
			return dataResponse;
		}
		if(uploadFlag==5){
			log.info("zip包的saveData失败，此次上传zip包失败");
			dataResponse.setCode(ResponseStatusEnum.FAIL_CODE.getCode());
			dataResponse.setMsg(ResponseStatusEnum.FAIL_CODE.getName()+"	"+"zip包的saveData失败，此次上传zip包失败");
			CollectDataServiceImpl.deleteAll(new File(path));
			CollectDataServiceImpl.deleteAll(new File(filePath));
			return dataResponse;
		}
		if(uploadFlag==6){
			log.info("zip上传updateData的传参有问题");
			dataResponse.setCode(ResponseStatusEnum.FAIL_CODE.getCode());
			dataResponse.setMsg(ResponseStatusEnum.FAIL_CODE.getName()+"	"+"zip上传updateData的传参有问题");
			CollectDataServiceImpl.deleteAll(new File(path));
			CollectDataServiceImpl.deleteAll(new File(filePath));
			return dataResponse;
		}
		if(uploadFlag==7){
			log.info("zip包的saveData失败，此次上传zip包失败");
			dataResponse.setCode(ResponseStatusEnum.FAIL_CODE.getCode());
			dataResponse.setMsg(ResponseStatusEnum.FAIL_CODE.getName()+"	"+"zip包的saveData失败，此次上传zip包失败");
			CollectDataServiceImpl.deleteAll(new File(path));
			CollectDataServiceImpl.deleteAll(new File(filePath));
			return dataResponse;
		}
		dataResponse.setCode(ResponseStatusEnum.SUCCESS_CODE.getCode());
		dataResponse.setMsg(ResponseStatusEnum.SUCCESS_CODE.getName()+"	"+"zip包上传成功");
		return dataResponse;
	}


}
